﻿const express = require('express');
const db = require('./data/database');
const todosRoutes = require('./routes/todos.routes');

const quoteRouter = require('./routes/quotes.routes');

const app = express();

app.use(express.json());

app.use('/todos', todosRoutes);

app.use('/quote', quoteRouter);

app.use(function (error, req, res, next) {
    res.status(500).json({
        message: 'Something went wrong!'
    });
});


app.listen(3000);

// db.initDb().then(function () {
//     app.listen(3000);
// }).catch(function (error) {
//     console.log('Connecting ot the db failed!');
// });
